import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);

export default new Router({
  routes: [
    {
      path:"*",
      name:"404notfound",
      component:() => import("./components/404.vue")
    },
    {
      path:"/error",
      name:"error",
      component:() => import("./components/error.vue")
    },
    {
      path: "/login",
      name: "login",
      component: () => import("./views/login/index.vue")
    },
    {
      path: "/",
      name: "layout",
      redirect: "/home",
      component: () => import("@/components/layout"),
      children: [
        {
          path: "/home",
          component: () => import("./views/home/index.vue"),
          meta: { title: "首页" }
        },
   
        {
          path: "/article",
          component: () => import("./views/article/index.vue"),
          meta: { title: "书籍首页" }
        },
        {
          path: "/publish",
          component: () => import("./views/article/publish.vue"),
          meta: { title: "发布文章" }
        },
        {
          path: "/tag",
          component: () => import("./views/article/tag.vue"),
          meta: { title: "标签管理" }
        },
        {
          path: "/category",
          component: () => import("./views/article/category.vue"),
          meta: { title: "分类管理" }
        },
        {
          path: "/comment",
          component: () => import("./views/article/comment.vue"),
          meta: { title: "评论管理" }
        },
        {
          path: "/user",
          component: () => import("./views/user/index.vue"),
          meta: { title: "用户管理" }
        },
        {
          path: "/admin",
          component: () => import("./views/user/admin.vue"),
          meta: { title: "系统管理员" }
        },
        {
          path: "/role",
          component: () => import("./views/user/role.vue"),
          meta: { title: "角色管理" }
        },
        {
          path: "/permission",
          component: () => import("./views/user/permission.vue"),
          meta: { title: "权限管理" }
        },
        {
          path: "/homePage",
          name: "HomePage",
          component: () => import("./views/user/homePage.vue"),
          meta: { title: "主页" }
        }
      ]
    }
  ]
});
